#include "StdAfx.h"

#include "ColorUtils/Color.h"

#include "FirstIntersectionResult.h"
#include "SecondIntersectionResult.h"

#include "Intersectable.h"

FirstIntersectionResult::FirstIntersectionResult(double distance, Intersectable* obj) : Distance(distance), Obj(obj)
{}

FirstIntersectionResult::FirstIntersectionResult(Intersectable* obj) : Distance(std::numeric_limits<double>::infinity()), Obj(obj)
{}

FirstIntersectionResult::FirstIntersectionResult()
{}

bool FirstIntersectionResult::DoesIntersect()
{
	return (Distance == std::numeric_limits<double>::infinity() || Distance <= 0) ? false : true;
}

void FirstIntersectionResult::Set(double distance, /*const*/ Intersectable* obj)
{
	Distance = distance;
	Obj = obj;
}

void FirstIntersectionResult::Set(Intersectable* obj)
{
	Distance = std::numeric_limits<double>::infinity();
	Obj = obj;
}
